# -*- coding:utf-8 -*-

"""
Map - 哈希表
    一种关联数组的数据结构，也常被称为字典或键值对
"""

# map 在 python 中是一个keyword
hash_map = {} # or dict()
print(hash_map)
hash_map['king'] = 98
print(hash_map)
hash_map['sley'] = 99
print(hash_map)
exist = 'king' in hash_map # check existence
point = hash_map['king'] # get value by key
point = hash_map.pop('king') # remove by key, return value
print(point)
print(hash_map)
keys = hash_map.keys() # return key list
print(keys)
# iterate dictionary(map)
for key, value in hash_map.items():
    # do something with k, v
    pass